home *** CD-ROM | disk | FTP | other *** search
/ LineOne ISP Sign-Up 5 / LineOne.iso / assets / cxt / scripts / parentScripts.cst / 00072_feedbackService parent.ls < prev    next >
Encoding:
Text File  |  2001-01-27  |  3.8 KB  |  140 lines

  1. -- 2000.03.06
  2. -- Clive Green <clivegreen@atlas.co.uk>
  3.  
  4. ------------------------------------------------------------------------------------------------------
  5.  
  6. -- this displays a text feedback message string in a miaw (if the miaw file is available).
  7.  
  8. ------------------------------------------------------------------------------------------------------
  9.  
  10. -- declare properties:
  11. property main             -- main code directory object
  12. property miawFileName     -- the director movie file name to open
  13. property miaw             -- a reference to the Director MIAW entity
  14. property miawLeft,miawTop -- the onscreen position of the miaw
  15. property miawShown        -- flags whether the miaw is visible or not
  16.  
  17. ------------------------------------------------------------------------------------------------------
  18.  
  19. on new me,L
  20.   
  21.   -- (1) extract and check arguments:
  22.   
  23.   -- check for a parameter list:
  24.   if ilk(L) <> #propList then return [#error:#noParamListSupplied, #msg:"feedbackService:new"]
  25.   
  26.   -- a reference to the parent codebase is REQUIRED:
  27.   main = L[#main]
  28.   if (ilk(main) <> #instance) then return [#error:#noMainObjectSupplied, #msg:"feedbackService:new"]
  29.   
  30.   --------------------
  31.   
  32.   -- (2) store my miaw's position data:
  33.   
  34.   -- what is the top-left corner of my miaw? 
  35.   miawLeft = the stageLeft
  36.   miawTop  = the stageBottom + 10
  37.   
  38.   --------------------
  39.   
  40.   -- (3) obtain my miaw's filepath:
  41.   
  42.   -- obtain the filePath of the miaw we want:
  43.   dm = main.getDataManager()
  44.   dL = dm.getData([#set:#filePaths, #item:#feedBackWin])
  45.   f = dL[#filePath]
  46.   
  47.   -- parse filepath for the current platform:
  48.   um = main.getUtilityMethods()
  49.   f = um.parseFilePath(f)
  50.   
  51.   -- prefix the filePath with the root directory path:
  52.   r = dm.getRootPath()
  53.   
  54.   -- finally - store the compiled filePath:
  55.   miawFileName = (r & f)
  56.   
  57.   --------------------
  58.   
  59.   -- (4) check that the miaw file actually exists:
  60.   
  61.   xm = main.getXtrasManager()
  62.   buddy = xm.getBuddyAPIxtra()
  63.   
  64.   if (ilk(buddy) <> #instance) then return ┬¼
  65.   [#error:#xtraControllerMissing, #msg:"feedbackService:openFeedback needs buddyAPIxtra"]
  66.   
  67.   -- determine miaw file's existence:
  68.   f = buddy.fileExists(miawFileName)
  69.   
  70.   -- clear invalidated filePath as needed:
  71.   if not stringP(f) then miawFileName = 0
  72.   
  73.   -------------------- 
  74.   
  75.   -- flag miaw is initially 'invisible':
  76.   miawShown = 0
  77.   
  78.   --------------------
  79.   
  80.   -- pass back my address:
  81.   return me
  82.   
  83.   ----------------------------------------------------------------------------------------------------
  84.   
  85. on openFeedback me
  86.   
  87.   -- first check that the required file exists:
  88.   if miawFileName = 0 then return 0
  89.   
  90.   -- special keypress required for feedback:
  91.   if not(the SHIFTDOWN) then return 0
  92.   
  93.   --------------------  
  94.   
  95.   -- reference the miaw movie:
  96.   miaw = window(miawFileName)
  97.   
  98.   -- position window area, and open:
  99.   r = miaw.rect
  100.   w = r[3]-r[1]
  101.   h = r[4]-r[2]
  102.   
  103.   r = rect(miawLeft,miawTop,miawLeft + w,miawTop + h) 
  104.   miaw.rect = r
  105.   
  106.   --------------------
  107.   
  108.   -- we'll use a windowType with no titleBar:
  109.   miaw.windowType = 2
  110.   open miaw
  111.   
  112.   -- flag miaw is now 'visible':
  113.   miawShown = 1
  114.   
  115.   -- :
  116.   me.feedbackMsg("READY")
  117.   
  118.   ----------------------------------------------------------------------------------------------------
  119.   
  120. on clearFeedback me
  121.   
  122.   -- clean up and close window as neeeded:
  123.   if not(miawShown) then return 0
  124.   
  125.   close miaw
  126.   forget miaw
  127.   
  128.   -- flag miaw is 'invisible':
  129.   miawShown = 0
  130.   
  131.   ----------------------------------------------------------------------------------------------------
  132.   
  133. on feedbackMsg me,s
  134.   
  135.   -- pass the feedback message string to the miaw if possible:
  136.   if not(miawShown) then return 0
  137.   
  138.   tell miaw to displayFeedback(s)
  139.   
  140.   ----------------------------------------------------------------------------------------------------